package com.ldu.exam.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PageableDefault;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.ldu.exam.model.SubmitPaper;
import com.ldu.exam.service.ScoreService;

@RequestMapping(value="/Score")
@RestController
public class ScoreController 
{
	@Autowired ScoreService service;
	
	@GetMapping()
	public Page<SubmitPaper> findByStudentId(@RequestParam String accountId,@PageableDefault(size=20) Pageable page)
	{
		return this.service.findAllByUserId(accountId, page);
	}
	
	@GetMapping("/forTeacher")
	public Page<SubmitPaper> findForTeacher(@RequestParam String accountId,@PageableDefault(size=20) Pageable page)
	{
		return this.service.findForTeacher(accountId, page);
	}
}
